package boststrap

import (
	"fmt"
	"github.com/gin-contrib/sessions"
	"github.com/gin-gonic/gin"
	"social-app/config"
	"social-app/pkg/logger"
	"social-app/pkg/session"
	"social-app/router"
)

func Run() {
	r := gin.Default()
	// 加载Session
	r.Use(sessions.Sessions("mysession", session.SessionStore))
	// 错误日志执行
	r.Use(logger.Log())
	// 错误信息处理
	r.Use(logger.Recover)
	r = router.InitRouter(r)
	r.Run(fmt.Sprintf(":%d", config.AppConfig.AppPort))
}
